package com.otr.ai.service;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class WeatherTools {

  @Tool(description = "获取今天日期")
  public String getCurrentDateTime() {
    log.info("====== getCurrentDateTime ======");
    return LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
  }

  @Tool(description = "获取指定城市的温度")
  public String getCurrentTemperature(@ToolParam(description = "城市名称") String cityName) {
    // 模拟调用天气 API
    String result = cityName + "当前温度为25℃。--By Tool Calling";
    log.info("====== getCurrentTemperature, res: {} ======",result);
    return result;
  }
}
